Skip to content

Support gh and hf CLIs in agent sandboxes#177

Open
akseljoonas wants to merge 1 commit intomainfrom
fix/gh-hf-cli-sandbox-guidance
Open

Support gh and hf CLIs in agent sandboxes#177
akseljoonas wants to merge 1 commit intomainfrom
fix/gh-hf-cli-sandbox-guidance

Conversation

@akseljoonas
Copy link
Copy Markdown
Collaborator

@akseljoonas akseljoonas commented Apr 28, 2026

Summary

  • install GitHub CLI and Hugging Face CLI in generated sandbox images
  • document when agents should use gh/hf through bash in sandbox and local CLI modes
  • allow sandbox_create to receive a user-owned GitHub token as GH_TOKEN/GITHUB_TOKEN while continuing to inject the user's HF_TOKEN

Fixes #167.

Tests

  • UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev pytest tests/unit/test_sandbox_cli_support.py tests/unit/test_sandbox_api_auth.py tests/unit/test_sandbox_already_active_message.py
  • Live cpu-basic sandbox akseljoonas/ml-intern-cli-live-f54f2f70: verified gh path/version, hf path/version, hf auth whoami, HF_TOKEN present; deleted after test

Not tested

  • Authenticated GitHub CLI operations inside a sandbox with a real user GitHub token; no user GitHub token was supplied for live testing

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

The sandbox already exposes bash as the escape hatch for live repository and Hub operations, so this change teaches the model when to use gh/hf there and installs the CLIs in the generated sandbox image. GitHub credentials stay user-owned: HF_TOKEN is injected from the user's HF session, while GH_TOKEN/GITHUB_TOKEN are only added when the user explicitly supplies a GitHub token to sandbox_create.

Constraint: Issue #167 reports that models cannot access GitHub reliably through the current guidance.

Rejected: Reusing a server or maintainer GitHub token | GitHub access must be scoped to the user's own account.

Confidence: high

Scope-risk: narrow

Directive: Do not broaden GitHub token propagation without a user-owned auth path.

Tested: UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev pytest tests/unit/test_sandbox_cli_support.py tests/unit/test_sandbox_api_auth.py tests/unit/test_sandbox_already_active_message.py

Tested: Live cpu-basic sandbox akseljoonas/ml-intern-cli-live-f54f2f70 verified gh path/version, hf path/version, hf auth whoami, HF_TOKEN present, then deleted.

Not-tested: Authenticated GitHub CLI operations inside a sandbox with a real user GitHub token; no user GitHub token was supplied for live testing.
@akseljoonas akseljoonas force-pushed the fix/gh-hf-cli-sandbox-guidance branch from 485a702 to 310bce1 Compare April 28, 2026 18:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@fglogan
Copy link
Copy Markdown

fglogan commented May 3, 2026

closed per maintainer request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't access github

2 participants